/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主内容区样式 */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

/* 表单样式 */
.tts-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

#text-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

#text-input:focus {
    outline: none;
    border-color: #667eea;
}

#voice-select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#voice-select:focus {
    outline: none;
    border-color: #667eea;
}

#speed-input {
    width: 100%;
    margin-bottom: 5px;
}

#speed-value {
    display: inline-block;
    margin-left: 10px;
    font-weight: 500;
    color: #667eea;
}

/* 按钮样式 */
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background-color: #667eea;
    color: white;
}

.btn-primary:hover {
    background-color: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background-color: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background-color: #cbd5e0;
}

.btn-download {
    background-color: #38a169;
    color: white;
    margin-top: 10px;
}

.btn-download:hover {
    background-color: #2f855a;
}

/* 结果区样式 */
.result {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.result h2 {
    margin-bottom: 20px;
    color: #4a5568;
}

#loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid rgba(102, 126, 234, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #667eea;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error {
    background-color: #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #c53030;
}

.success {
    background-color: #c6f6d5;
    color: #276749;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #276749;
}

.audio-controls {
    margin-top: 15px;
}

#audio-player {
    width: 100%;
    margin-bottom: 10px;
}

/* 历史记录样式 */
.history {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.history h2 {
    margin-bottom: 20px;
    color: #4a5568;
}

.history-controls {
    margin-bottom: 20px;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s ease;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item:hover {
    background-color: #f7fafc;
}

.history-item-text {
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 0.9rem;
    color: #718096;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}